// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

const int N = 4e4+50;

using LL = long long;

namespace math {

int mu[N], prime[N], pcnt, phi[N];
int minp[N];
int smu[N];
LL sphi[N];
void init() {
    mu[1] = 1;
    minp[1] = 0;
    for (int i = 2; i < N; ++i) {
        if (!minp[i]) {
            minp[i] = i;
            prime[pcnt++] = i;
            mu[i] = -1;
        }
        for (int j = 0; j < pcnt; ++j) {
            LL nextp = 1LL * i * prime[j];
            if (nextp >= N)
                break;
            if (!minp[nextp])
                minp[nextp] = prime[j];
            if (i % prime[j] == 0) {
                mu[nextp] = 0;
                break;
            } else {
                mu[nextp] = -mu[i];
            }
        }
    }
    for (int i = 1; i < N; ++i) {
        smu[i] = smu[i - 1] + mu[i];
        sphi[i] = sphi[i - 1] + phi[i];
    }
}

template <typename T>
vector<pair<T, int>> pfac(T x) {
    vector<pair<T, int>> res;
    if (x < N)
        while (x > 1) {
            int cnt = 0, p = minp[x];
            while (x % p == 0) {
                ++cnt;
                x /= p;
            }
            res.emplace_back(p, cnt);
        }
    else {
        for (int i=0; i<pcnt; ++i) {
            int p = prime[i];
            if (1LL * p * p > x)
                break;
            if (x % prime[i] == 0) {
                int cnt = 0;
                while (x % prime[i] == 0) {
                    ++cnt;
                    x /= prime[i];
                }
                res.emplace_back(p, cnt);
            }
        }
        if (x > 1)
            res.emplace_back(x, 1);
    }
    return res;
}

template<typename T>
vector<T> fac(T x) {
    vector<T> res;
    for (int i=0; 1LL*i*i<x; ++i) {
        if (x % i == 0) {
            res.push_back(i);
            if (x/i != i)
                res.push_back(x/i);
        }
    }
    return res;
}

vector<vector<int>> facN(int n) {
    vector<vector<int>> fac;
    fac.resize(n+1);
    for (int i=1;i<=n; ++i) {
        for (int j=i; j<=n; j+=i) {
            fac[j].push_back(i);
        }
    }
    return fac;
}

}  // namespace math


const int M = 200;
const int MOD = 998244353;


unordered_map<LL, unordered_map<LL, int>> pmp;

inline void dec(LL x, unordered_map<LL, int> &mp) {
	if (--mp[x] == 0)
		mp.erase(x);
}


void dfs(LL now, unordered_map<LL, int> &s) {
	pmp[now] = s;

	vector<LL> v;
	for (const auto &p : s) {
		v.push_back(p.first);
	}

	for (const auto &p : v) {
		dec(p, s);
		dfs(now / p, s);
		s[p]++;
	}
}

LL C[M][M];


LL solve(LL u, LL v) {
	const auto &mp = pmp[v/u];

	LL ans = 1;
	int cur = 0;
	for (const auto &p : mp) {
		ans = ans * C[cur+p.second][p.second];
		// dbg(cur, p.second);
		cur += p.second;
	}
	return ans;
}

struct E {
    int u, v, w;
    E(int u=0, int v=0, int w=0):u(u), v(v), w(w) {}
};

vector<E> brutalForce(int d, int &n) {
    auto fac = math::facN(d);
    vector<E> res;
    const auto &v = fac[d];
    for (int ux : v)
        for (int vx : v) {
            if (vx % ux == 0 && math::minp[vx / ux] == vx / ux) {
                res.emplace_back(ux, vx, fac[vx].size() - fac[ux].size());
            }
        }
    n = fac[d].size();
    return res;
}

int main(int argc, char const *argv[]) {
    // code

    C[0][0] = 1;
    for (int i=1; i<M; ++i) {
    	C[i][0] = C[i][i] = 1;
    	for (int j=1; j<i; ++j)
    		C[i][j] = (C[i-1][j-1] + C[i-1][j]) % MOD;
    }
    math::init();
    int d, n;
    cin >> d;
    auto e = brutalForce(d, n);
    printf("%d %d\n", n, (int)e.size());
    for (const auto &p : e) {
        printf("%d %d %d\n", p.u, p.v, p.w);
    }
    // LL d;
    // cin >> d;

    // auto vp = math::pfac(d);
    // unordered_map<LL, int> mp;
    // LL tot = 1;
    // for (const auto &p : vp) {
    // 	dbg(p.first, p.second);
    // 	mp[p.first] = p.second;
    // 	tot *= p.second + 1;
    // }

    // dbg(tot);

    // dbg("dfs");
    // dfs(d, mp);
    // dbg("ed");
    // int q;
    // scanf("%d", &q);
    // for (int kk=0; kk<q; ++kk) {
    // 	LL u, v;
    // 	scanf("%lld%lld", &u, &v);
    // 	LL g = __gcd(u, v);
    // 	LL ans = solve(g, u) * solve(g, v) % MOD;
    // 	printf("%lld\n", ans);
    // }



    return 0;
}